package student;

import student.StudentEntity;

import javax.persistence.*;

public class DeleteStudent {
    public static void main(String args[]) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("Student_details");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();

        StudentEntity s = em.find(StudentEntity.class, 1001);
        em.remove(s);
        em.getTransaction().commit();
        em.close();
        emf.close();
        System.out.println("删除成功");
    }
}
